<!--
    model渲染展示类型基类
-->
<template>
    <div>
        <Modal v-model="modal" class="modal-full" :class="{['modal-action-'+actionModel.type]:true}" :title="modalTitle" width="90%">
            <div v-if="modalShow">
                <ModelComponent ref="item" v-if="isParse" :model="parseModel" :hasCheck="true" :fixedFilter="fixedFilter"></ModelComponent>
            </div>
            <div slot="footer" class="button-panel-button">
                <i-button @click="close">返回</i-button>
            </div>
        </Modal>
    </div>
</template> 

<script>
import ModalBase from "../modalBase";
import $ from "@/common";
import ModelComponent from "@/node/gridPanel/index";
import { billParser } from "@/common/parser";

export default {
  extends: ModalBase,
  props: {},
  data() {
    return {
      billModel: {},
      parseModel: {},
      fixedFilter: {},
      isParse: false
    };
  },
  computed: {
    modelPath() {
      return (
        this.actionModel.path ||
        this.$parent.modelParam("path_find") ||
        this.$parent.modelParam("path")
      );
    }
  },
  methods: {
    load() {
      this.isParse = false;
      $.link(this.modelPath, null, {
        param: this.$parent.actionData
      }).then(res => {
        this.billModel = res.data;
        this.parseModel = this.modelParser(res.data);
        this.afterLoad();
        this.isParse = true;
      });
    },
    afterLoad() {},
    modelParser(data) {
      return billParser(data);
    }
  },
  components: {
    ModelComponent
  }
};
</script>